import { NodeStatues } from "../Enum/index";


export default abstract class BTNode{
    statues:NodeStatues = NodeStatues.Inactive;


    run(){
        if(this.statues==NodeStatues.Inactive){
            this.onstart();

        }
        const res=this.onUpdate();
        if(res!==NodeStatues.Running)
        this.onEnd();
    return res
    }
    onstart():void{
        this.statues=NodeStatues.Running;
    }
    onUpdate():NodeStatues{
        return NodeStatues.Success;
    }
    
    onEnd():void{
        this.statues=NodeStatues.Inactive;

    }
}